package com.droidblackbox.accident;

import org.json.JSONArray;
import org.json.JSONObject;

import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.widget.Toast;

import com.droidblackbox.DroidBlackBox;
import com.droidblackbox.R;
import com.droidblackbox.manager.C2DMManager;
import com.droidblackbox.manager.NotiManager;
import com.google.android.maps.MapActivity;

public class AccidentMapView extends MapActivity {

	@Override
	protected boolean isRouteDisplayed() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.accident_info);

		Intent intent = getIntent();
		Bundle bundle = intent.getExtras();
		String string = bundle.getString(C2DMManager.EXTRA_KEY);
		
		Toast.makeText(this, string, Toast.LENGTH_SHORT).show();

		NotiManager notiManager = new NotiManager(this);
		notiManager.cancel(C2DMManager.ID_RECEIVE_NOTIFICATION);

		try {
			JSONObject jsonObject = new JSONObject(string);
			JSONArray jsonArray = jsonObject.names();

		} catch (Exception e) {
			// TODO: handle exception
		}

	}

	public boolean onKeyDown(int keyCode, KeyEvent event) {

		if (event.getAction() == KeyEvent.ACTION_DOWN) {
			switch (keyCode) {
			case KeyEvent.KEYCODE_BACK:
				finish();
				return true;
			}
		}
		return false;
	}

}
